/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package thienphuc.patient.bo.impl;

import java.util.Date;
import java.util.List;
import thienphuc.patient.bo.DonThuocBO;
import thienphuc.patient.dao.DonThuocDAO;
import thienphuc.patient.dao.impl.DonThuocDAOImpl;
import thienphuc.patient.dto.BenhAn;
import thienphuc.patient.dto.DonThuoc;

/**
 *
 * @author QuocDat
 */
public class DonThuocBOImpl implements DonThuocBO {

    private DonThuocDAO donThuocDAO;

    public DonThuocBOImpl() {
        this.donThuocDAO = new DonThuocDAOImpl(DonThuoc.class);
    }
    
    public List<DonThuoc> getAll() throws Exception {
        return this.donThuocDAO.findAll();
    }

    public DonThuoc getById(int maDonThuoc) throws Exception {
        return this.donThuocDAO.findById(maDonThuoc);
    }

    public List<DonThuoc> getByBenhAn(BenhAn benhAn) throws Exception {
        return this.donThuocDAO.findByBenhAn(benhAn);
    }

    public List<DonThuoc> getByTrangThaiThanhToan(boolean trangThaiThanhToan) throws Exception {
        return this.donThuocDAO.findByTrangThaiThanhToan(trangThaiThanhToan);
    }

    public boolean insertDonThuoc(DonThuoc donThuoc) throws Exception {
        return this.donThuocDAO.save(donThuoc);
    }

    public boolean updateDonThuoc(DonThuoc donThuoc) throws Exception {
        return this.donThuocDAO.update(donThuoc);
    }

    public List<DonThuoc> getByNgayKeDon(Date ngayKeDonStart, Date ngayKeDonEnd) throws Exception {
        return this.donThuocDAO.findByNgayKeDon(ngayKeDonStart, ngayKeDonEnd);
    }
}
